# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, pysozluk-qt Development Team
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#

import sys
from PyQt4 import QtCore, QtGui
from core import pysozlukCore
from gettext import translation

_ = translation('pysozluk-qt', fallback=True).ugettext

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(QtCore.QSize(QtCore.QRect(0,0,400,300).size()).expandedTo(MainWindow.minimumSizeHint()))
        MainWindow.setWindowIcon(QtGui.QIcon("/usr/share/icons/hicolor/scalable/apps/pysozluk-qt.svg"))

        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")

        self.gridlayout = QtGui.QGridLayout(self.centralwidget)
        self.gridlayout.setMargin(9)
        self.gridlayout.setSpacing(6)
        self.gridlayout.setObjectName("gridlayout")

        self.lineEdit = QtGui.QLineEdit(self.centralwidget)
        self.lineEdit.setObjectName("lineEdit")
        self.gridlayout.addWidget(self.lineEdit,1,1,1,1)

        self.label = QtGui.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.gridlayout.addWidget(self.label,1,0,1,1)

        self.pushButton = QtGui.QPushButton(self.centralwidget)
        self.pushButton.setObjectName("pushButton")
        self.gridlayout.addWidget(self.pushButton,1,2,1,1)

        self.textBrowser = QtGui.QTextBrowser(self.centralwidget)
        self.textBrowser.setObjectName("textBrowser")
        self.gridlayout.addWidget(self.textBrowser,0,0,1,3)
        MainWindow.setCentralWidget(self.centralwidget)

        self.menubar = QtGui.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0,0,400,29))
        self.menubar.setObjectName("menubar")

        self.menuFile = QtGui.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")

        self.menuMode = QtGui.QMenu(self.menubar)
        self.menuMode.setObjectName("menuMode")

        self.menuHelp = QtGui.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        MainWindow.setMenuBar(self.menubar)

        self.statusbar = QtGui.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.actionAbout_Pysozluk_Qt = QtGui.QAction(MainWindow)
        self.actionAbout_Pysozluk_Qt.setObjectName("actionAbout_Pysozluk_Qt")

        self.actionAbout_Qt = QtGui.QAction(MainWindow)
        self.actionAbout_Qt.setObjectName("actionAbout_Qt")

        self.actionOffline = QtGui.QAction(MainWindow)
        self.actionOffline.setCheckable(True)
        self.actionOffline.setChecked(True)
        self.actionOffline.setObjectName("actionOffline")

        self.actionSave = QtGui.QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")

        self.actionQuit = QtGui.QAction(MainWindow)
        self.actionQuit.setObjectName("actionQuit")
        self.menuFile.addAction(self.actionSave)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionQuit)
        self.menuMode.addAction(self.actionOffline)
        self.menuHelp.addAction(self.actionAbout_Pysozluk_Qt)
        self.menuHelp.addAction(self.actionAbout_Qt)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuMode.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())

        self.retranslateUi(MainWindow)
        self.core = pysozlukCore(self, MainWindow)
        QtCore.QObject.connect(self.actionAbout_Pysozluk_Qt,QtCore.SIGNAL("activated()"),self.core.about)
        QtCore.QObject.connect(self.actionAbout_Qt,QtCore.SIGNAL("activated()"),self.core.aboutQt)
        QtCore.QObject.connect(self.actionOffline,QtCore.SIGNAL("activated()"),self.core.toggleOffline)
        QtCore.QObject.connect(self.actionQuit,QtCore.SIGNAL("activated()"),MainWindow.close)
        QtCore.QObject.connect(self.actionSave,QtCore.SIGNAL("activated()"),self.core.save)
        QtCore.QObject.connect(self.pushButton,QtCore.SIGNAL("clicked()"),self.core.search)
        QtCore.QObject.connect(self.lineEdit,QtCore.SIGNAL("returnPressed()"),self.core.search)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.lineEdit,self.textBrowser)
        MainWindow.setTabOrder(self.textBrowser,self.pushButton)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_("Pysozluk-Qt"))
        self.label.setText(_("Keyword:"))
        self.pushButton.setText(_("&Search"))
        self.textBrowser.setHtml("<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
        "p, li { white-space: pre-wrap; }\n"
        "</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">\n"
        "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p></body></html>")
        self.menuFile.setTitle(_("&File"))
        self.menuMode.setTitle(_("&Mode"))
        self.menuHelp.setTitle(_("&Help"))
        self.actionAbout_Pysozluk_Qt.setText(_("About &Pysozluk-Qt"))
        self.actionAbout_Qt.setText(_("About &Qt"))
        self.actionOffline.setText(_("&Offline"))
        self.actionOffline.setShortcut("Ctrl+M")
        self.actionSave.setText(_("&Save"))
        self.actionSave.setShortcut("Ctrl+S")
        self.actionQuit.setText(_("&Quit"))
        self.actionQuit.setShortcut("Alt+F4")
